Considering Issues Around the Application on ColdFusion MX Clusters
Take the following into consideration when creating ColdFusion MX Clusters:
Separate static and dynamic content to improve performance. With ColdFusion MX for J2EE, all requests to the web server, to http://server/cfusion (context root) will go to JRun regardless of the extension (CFM, HTM, GIF, JPG). If images and static content exist in /cfusion, all static content will go through ISAPI Rewrite, then through the hardware load balancing device, and finally the application server will serve the page. This defeats the purpose of high-performance caching built into the web server. Therefore, we recommend that you place all static content in a folder outside of the /cfusion folder within the web server root. For example, put all HTML files in a /html folder and place all images underneath the web server root. In a site with a significant amount of static content you will see a significant improvement in throughput and pages/sec by separating the content; in some cases, the performance improves 200-300%.
Develop your application with a context root in mind. With ColdFusion MX for J2EE your application will use a context root. In most cases, it will either be /cfusion or /cfmx, but as a developer, you may not have final control of the environment you deploy to. Prior to ColdFusion MX for J2EE, the context root was just / and it was simple to use absolute paths that started with /. For example, you might code a URL that uses an absolute path, such as <a href=/index.cfm>Home Page</a>. If you moved this code to ColdFusion MX for J2EE, then the server would not find the page because it expects a prefix with a context root for the URL. The URL with a context root would look something like the following <a href=/cfusion/index.cfm>Home Page</a>. What if you moved this application to an environment where the context root was different? As a developer, you would not want to go back and change all the URLs within your application. The best way to prevent this issue is to develop with a context root in mind. By this, I mean you should prefix all URLs with a variable that you set in the application.cfm. Add the following line of code in your application.cfm file. It will retrieve the context root of the application server. Then you can use this variable to prefix all URLs.
< cfset request.contextURL=getPageContext().getRequest().getContextPath()>
If the context root of your application is /cfusion, then use a value of request.contextURL. If you use this code on ColdFusion MX Professional or Enterprise versions, the value will be an empty string. The following illustrates an example of how you would use this variable in your code.
< cfoutput> <a href=#request.contextURL#/index.cfm>Home Page</a> < /cfoutput>
Now no matter where you deploy this application, in either ColdFusion MX or ColdFusion MX for J2EE you will not need to change the code. The context root will be pre-pended to all of your URLs.
Note: Context root is a J2EE term for the application mapping of a particular application. When you install ColdFusion MX for J2EE, it asks you to specify a context root, or the URL that will answer requests. For example, if you specify a context root of cfmx, the URL would be http://server/cfmx/page.cfm. The /cfmx in the URL is not a physical directory; it is a virtual URL that directs the request to the J2EE application server. Defining unique context roots only becomes necessary when you have multiple J2EE application servers connected to a single web server. Each application server must have a unique context root to avoid conflicts.
Conclusion
The J2EE model is the new enterprise; this article described how you can use ColdFusion for J2EE to exploit this paradigm shift in network topology. ColdFusion server farms or pools running multiple instances behind multiple web servers and hardware load balancing devices provides robustness, speed, and scalability unparalleled in the industry. If your website is growing beyond the capabilities of previous models, then it’s time to consider ColdFusion MX for J2EE; it opens up many robust solutions.